﻿using System;
using System.Collections.Generic;
using SinBiota.Model.Business.PersistenceServices.Interfaces;
using SinBiota.Model.Entities;
using SinBiota.Model.Persistence.Repositories.Interfaces;

namespace SinBiota.Model.Business.PersistenceServices.Implementation
{
    public class EcosystemPersistenceServices : IEcosystemPersistenceServices
    {
        private readonly IEcosystemRepository _ecosystemRepository;

        public EcosystemPersistenceServices(IEcosystemRepository ecosystemRepository)
        {
            _ecosystemRepository = ecosystemRepository;
        }

        public Ecosystem FindById(int id)
        {
            return _ecosystemRepository.FindById(id);
        }

        public Ecosystem FindByName(string name)
        {
            return _ecosystemRepository.FindByName(name);
        }

        public IList<Ecosystem> FindAll()
        {
            return _ecosystemRepository.FindAll();
        }

        public void Delete(Ecosystem ecosystem)
        {
            _ecosystemRepository.Delete(ecosystem);
        }
        public void DeleteById(int id)
        {
            Delete(FindById(id));
        }

        public void Save(Ecosystem ecosystem)
        {
            _ecosystemRepository.Save(ecosystem);
        }

        public void Update(Ecosystem ecosystem)
        {
            _ecosystemRepository.Update(ecosystem);
        }

        public IList<Ecosystem> FindByNameLike(string name)
        {
            return _ecosystemRepository.FindByNameLike(name);
        }
    }
}